package com.zndroid.upgrader.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class DBHelper extends SQLiteOpenHelper{

	public static final String DB_NAME = "up_grader.db";
	public static final String TABLE_NAME = "task_info";
	public static final int VERSION = 1;
	private static final String SQL_CREATE_TABLE = "create table if not exists " + TABLE_NAME + "(" +
			"url text," +
			"start long," +
			"size long)";
	private static final String SQL_DROP = "drop table if exists " + TABLE_NAME;
	
	public DBHelper(Context context, String name, CursorFactory factory,
					int version) {
		super(context, name, factory, version);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL(SQL_CREATE_TABLE);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int arg1, int arg2) {
		db.execSQL(SQL_DROP);
		db.execSQL(SQL_CREATE_TABLE);
	}

}
